Conversation
|
The idea here seems sound, and your explanation of why the different functions existed in the first place is better than the doc we currently have IMO. So, if you wouldn't mind updating that part of the doxygen to remove the mention of val_op and update our description of adj_op, I think this is good to go |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
|
One Q, should we just make the |
I think this PR is actually removing an odd pattern |
|
Oh! Sorry I was misreading things. Yes I think I like this PR |
WardBrian
left a comment
There was a problem hiding this comment.
Doxygen still needs to be updated
Summary
The
.val()custom Eigen member always returns aCwiseUnaryViewwhen called on a non-const input (as aCwiseUnaryViewcan be assigned to). However theCwiseUnaryViewcan result in compilation errors in some Eigen expressions and so theval_op()member was introduced as a way to explicitly request aCwiseUnaryOp(normally only called for const inputs).For
vartypes even though thevaritself is non-const, theval_member of the underlyingvariis always const - so we actually always want aCwiseUnaryOp.This PR replaces the
val_op()implementation with template overloads for theval()implementation - only returningCwiseUnaryViewforfvarinputs, otherwise returning aCwiseUnaryOp.All usages of
val_op()through the codebase have also been replaced with justval()Tests
N/A - existing tests should successfully compile and run
Side Effects
N/A
Release notes
The
.val()member function always returns aCwiseUnaryOpwhen called with avartype, theval_op()member function has been removedChecklist
Copyright holder: Andrew Johnson
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit)make test-headers)make test-math-dependencies)make doxygen)make cpplint)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested